<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>LTE-UNB: TimeManager/TimeManager.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">LTE-UNB
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">TimeManager/TimeManager.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_time_manager_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00018"></a>00018 <span class="preprocessor">#ifndef _TimeManager_h_</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#define _TimeManager_h_</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;itpp/itbase.h&gt;</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="keyword">using namespace </span>itpp;
<a name="l00024"></a>00024 <span class="keyword">using namespace </span>std;
<a name="l00025"></a>00025 
<a name="l00030"></a><a class="code" href="namespace_time_manager.html">00030</a> <span class="keyword">namespace </span><a class="code" href="class_time_manager_1_1_time_manager.html">TimeManager</a>
<a name="l00031"></a>00031 {
<a name="l00032"></a>00032 
<a name="l00037"></a><a class="code" href="class_time_manager_1_1_time_manager.html">00037</a> <span class="keyword">class </span><a class="code" href="class_time_manager_1_1_time_manager.html">TimeManager</a>
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039    <span class="keyword">public</span>:
<a name="l00040"></a>00040            
<a name="l00045"></a>00045       <span class="keyword">virtual</span> ~<a class="code" href="class_time_manager_1_1_time_manager.html">TimeManager</a>();
<a name="l00046"></a>00046       
<a name="l00051"></a>00051       <span class="keyword">static</span> <a class="code" href="class_time_manager_1_1_time_manager.html">TimeManager</a>* getInstance();
<a name="l00052"></a>00052 
<a name="l00056"></a>00056       <span class="keywordtype">void</span> setParameters();
<a name="l00057"></a>00057       
<a name="l00062"></a>00062       <span class="keywordtype">void</span> initialize();
<a name="l00063"></a>00063       
<a name="l00068"></a>00068       <span class="keywordtype">void</span> clear();
<a name="l00069"></a>00069       
<a name="l00074"></a>00074       <span class="keywordtype">int</span> getCurrentStep();
<a name="l00075"></a>00075       
<a name="l00080"></a>00080       <span class="keywordtype">int</span> getCurrentResolutionStep();
<a name="l00081"></a>00081       
<a name="l00086"></a>00086       <span class="keywordtype">double</span> getCurrentTime();
<a name="l00087"></a>00087       
<a name="l00092"></a>00092       <span class="keywordtype">double</span> getTimeStep();
<a name="l00093"></a>00093       
<a name="l00098"></a>00098       <span class="keywordtype">void</span> update();
<a name="l00099"></a>00099       
<a name="l00104"></a>00104       <span class="keywordtype">void</span> setTimeResolution( <span class="keyword">const</span> <span class="keywordtype">double</span> timeStep );
<a name="l00105"></a>00105       
<a name="l00110"></a>00110       <span class="keywordtype">bool</span> validateTime();
<a name="l00111"></a>00111       
<a name="l00116"></a>00116       <span class="keywordtype">bool</span> hasResolutionStepChanged();
<a name="l00117"></a>00117      
<a name="l00118"></a>00118        
<a name="l00119"></a>00119       
<a name="l00120"></a>00120    <span class="keyword">private</span>:
<a name="l00121"></a>00121 
<a name="l00122"></a>00122       
<a name="l00127"></a>00127        <a class="code" href="class_time_manager_1_1_time_manager.html">TimeManager</a>();     
<a name="l00128"></a>00128       
<a name="l00133"></a>00133       <span class="keyword">static</span> <a class="code" href="class_time_manager_1_1_time_manager.html">TimeManager</a>* instance_;          
<a name="l00134"></a>00134       
<a name="l00139"></a>00139       <span class="keywordtype">int</span> currentStep_;   
<a name="l00140"></a>00140       
<a name="l00145"></a>00145       <span class="keywordtype">double</span> currentTime_;   
<a name="l00146"></a>00146       
<a name="l00151"></a>00151       <span class="keywordtype">int</span> currentResolutionStep_;
<a name="l00152"></a>00152       
<a name="l00157"></a>00157       <span class="keywordtype">int</span> totalSteps_;   
<a name="l00158"></a>00158       
<a name="l00163"></a>00163       <span class="keywordtype">double</span> totalTime_;   
<a name="l00164"></a>00164       
<a name="l00169"></a>00169       <span class="keywordtype">double</span> timeStep_;   
<a name="l00170"></a>00170       
<a name="l00175"></a>00175       <span class="keywordtype">double</span> timeResolution_; <span class="comment">// time for channel change</span>
<a name="l00176"></a>00176       
<a name="l00181"></a>00181       <span class="keywordtype">bool</span> resolutionStepHasChanged_;   
<a name="l00182"></a>00182 };
<a name="l00183"></a>00183 
<a name="l00184"></a>00184 };
<a name="l00185"></a>00185 
<a name="l00186"></a>00186 <span class="keyword">inline</span>
<a name="l00187"></a>00187 <span class="keywordtype">double</span>
<a name="l00188"></a>00188 <a class="code" href="class_time_manager_1_1_time_manager.html#a565a0edb1ff2404855d661dcb6dab79f">TimeManager::</a>
<a name="l00189"></a><a class="code" href="class_time_manager_1_1_time_manager.html#a565a0edb1ff2404855d661dcb6dab79f">00189</a> <a class="code" href="class_time_manager_1_1_time_manager.html#a565a0edb1ff2404855d661dcb6dab79f">TimeManager::getTimeStep</a>()
<a name="l00190"></a>00190 {
<a name="l00191"></a>00191    <span class="keywordflow">return</span> timeStep_;
<a name="l00192"></a>00192 };
<a name="l00193"></a>00193 
<a name="l00194"></a>00194 <span class="comment">// -----------------------------------------------------------------------------</span>
<a name="l00195"></a>00195 
<a name="l00196"></a>00196 <span class="keyword">inline</span>
<a name="l00197"></a>00197 <span class="keywordtype">double</span>
<a name="l00198"></a>00198 <a class="code" href="class_time_manager_1_1_time_manager.html#ac20f618f8db6600f1387571ec7d07904">TimeManager::</a>
<a name="l00199"></a><a class="code" href="class_time_manager_1_1_time_manager.html#ac20f618f8db6600f1387571ec7d07904">00199</a> <a class="code" href="class_time_manager_1_1_time_manager.html#ac20f618f8db6600f1387571ec7d07904">TimeManager::getCurrentTime</a>()
<a name="l00200"></a>00200 {
<a name="l00201"></a>00201    <span class="keywordflow">return</span> currentTime_;
<a name="l00202"></a>00202 };
<a name="l00203"></a>00203 
<a name="l00204"></a>00204 <span class="comment">// -----------------------------------------------------------------------------</span>
<a name="l00205"></a>00205 
<a name="l00206"></a>00206 <span class="keyword">inline</span>
<a name="l00207"></a>00207 <span class="keywordtype">int</span>
<a name="l00208"></a>00208 <a class="code" href="class_time_manager_1_1_time_manager.html#ac97851785c28bcf28efa4d8550759002">TimeManager::</a>
<a name="l00209"></a><a class="code" href="class_time_manager_1_1_time_manager.html#ac97851785c28bcf28efa4d8550759002">00209</a> <a class="code" href="class_time_manager_1_1_time_manager.html#ac97851785c28bcf28efa4d8550759002">TimeManager::getCurrentStep</a>()
<a name="l00210"></a>00210 {
<a name="l00211"></a>00211    <span class="keywordflow">return</span> currentStep_;
<a name="l00212"></a>00212 };
<a name="l00213"></a>00213 
<a name="l00214"></a>00214 <span class="comment">// -----------------------------------------------------------------------------</span>
<a name="l00215"></a>00215 
<a name="l00216"></a>00216 <span class="keyword">inline</span>
<a name="l00217"></a>00217 <span class="keywordtype">bool</span>
<a name="l00218"></a>00218 <a class="code" href="class_time_manager_1_1_time_manager.html#ab7e136d889466c629e80f6bd60806f05">TimeManager::</a>
<a name="l00219"></a><a class="code" href="class_time_manager_1_1_time_manager.html#ab7e136d889466c629e80f6bd60806f05">00219</a> <a class="code" href="class_time_manager_1_1_time_manager.html#ab7e136d889466c629e80f6bd60806f05">TimeManager::validateTime</a>()
<a name="l00220"></a>00220 {
<a name="l00221"></a>00221    <span class="keywordflow">return</span> currentStep_ &lt; totalSteps_;
<a name="l00222"></a>00222 };
<a name="l00223"></a>00223 
<a name="l00224"></a>00224 <span class="comment">// -----------------------------------------------------------------------------</span>
<a name="l00225"></a>00225 
<a name="l00226"></a>00226 <span class="keyword">inline</span>
<a name="l00227"></a>00227 <span class="keywordtype">void</span>
<a name="l00228"></a>00228 <a class="code" href="class_time_manager_1_1_time_manager.html#ad208e73a5d6369c9da3016333ad29c11">TimeManager::</a>
<a name="l00229"></a><a class="code" href="class_time_manager_1_1_time_manager.html#ad208e73a5d6369c9da3016333ad29c11">00229</a> <a class="code" href="class_time_manager_1_1_time_manager.html#ad208e73a5d6369c9da3016333ad29c11">TimeManager::setTimeResolution</a>( <span class="keyword">const</span> <span class="keywordtype">double</span> timeResolution )
<a name="l00230"></a>00230 {
<a name="l00231"></a>00231    timeResolution_ = timeResolution;
<a name="l00232"></a>00232 };
<a name="l00233"></a>00233 
<a name="l00234"></a>00234 <span class="comment">// -----------------------------------------------------------------------------</span>
<a name="l00235"></a>00235 
<a name="l00236"></a>00236 <span class="keyword">inline</span>
<a name="l00237"></a>00237 <span class="keywordtype">int</span>
<a name="l00238"></a>00238 <a class="code" href="class_time_manager_1_1_time_manager.html#a2356bb9aa6d3830148519b6ad926a307">TimeManager::</a>
<a name="l00239"></a><a class="code" href="class_time_manager_1_1_time_manager.html#a2356bb9aa6d3830148519b6ad926a307">00239</a> <a class="code" href="class_time_manager_1_1_time_manager.html#a2356bb9aa6d3830148519b6ad926a307">TimeManager::getCurrentResolutionStep</a>()
<a name="l00240"></a>00240 {
<a name="l00241"></a>00241    <span class="keywordflow">return</span> currentResolutionStep_;
<a name="l00242"></a>00242 };
<a name="l00243"></a>00243 
<a name="l00244"></a>00244 <span class="comment">// -----------------------------------------------------------------------------</span>
<a name="l00245"></a>00245 
<a name="l00246"></a>00246 <span class="keyword">inline</span>
<a name="l00247"></a>00247 <span class="keywordtype">bool</span>
<a name="l00248"></a>00248 <a class="code" href="class_time_manager_1_1_time_manager.html#aac0d7fa5bbb2d937cc357122f1e906ea">TimeManager::</a>
<a name="l00249"></a><a class="code" href="class_time_manager_1_1_time_manager.html#aac0d7fa5bbb2d937cc357122f1e906ea">00249</a> <a class="code" href="class_time_manager_1_1_time_manager.html#aac0d7fa5bbb2d937cc357122f1e906ea">TimeManager::hasResolutionStepChanged</a>()
<a name="l00250"></a>00250 {
<a name="l00251"></a>00251    <span class="keywordflow">return</span> resolutionStepHasChanged_;
<a name="l00252"></a>00252 };
<a name="l00253"></a>00253 
<a name="l00254"></a>00254 <span class="comment">// -----------------------------------------------------------------------------</span>
<a name="l00255"></a>00255 
<a name="l00256"></a>00256 
<a name="l00257"></a>00257 <span class="preprocessor">#endif</span>
</pre></div></div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Thu Oct 25 2012 22:25:35 for LTE-UNB by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
